﻿<cfsilent>
	<cfscript>
		
		sessionAdvice = getProperty("serviceFactory").getBean("sessionAdvice");
		
		teacherId = event.getArg("TCHID");
		
		sql = "SELECT 
			    a.tch_id, a.tch_name 
			    FROM t_teacher a 
			    WHERE a.tch_id = :teacherId ";
			    
		queryObj = new query( datasource=application.dnsSlave );
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" ); 
		
		rs_teacher = queryObj.execute( sql=sql ).getResult();
		
		sql = "SELECT 
					 a.stu_id, 
					 a.stu_name, 
					 a.stu_sex, 
					 a.stu_name_english, 
					 a.stu_idcard, 
					 a.stu_birthday, 
					 c.student_prop, 
					 a.nationality, 
           			(select to_char(d.name) from i_code_info d where d.code_id = c.st_id ) name 
				FROM 
					 t_student a 
					 INNER JOIN t_student_status c ON c.stu_id = a.stu_id  
				WHERE 
					a.tch_id = :teacherId 
				ORDER BY 
					a.stu_id DESC"; 
		
		queryObj = new Query( datasource=application.dnsSlave ); 
		queryObj.addParam( name="teacherId", value=teacherId, cfsqltype="cf_sql_varchar" ); 
		
		rs_student = queryObj.execute( sql=sql ).getResult(); 
		
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		propertyAdvice = getProperty("serviceFactory").getBean("studentPropertyAdvice");
		
		event.setArg("pageTitle", "教学运行基础数据 - 本科生管理");
		
		currentTab = event.getArg("TabID", "labStudent");
		
		targetArgs = structNew();
		
		
		passArgs = structNew();
		
		structInsert(passArgs, "tchId", teacherId);
		
		
		/* 计算在校学生人数 */
		inSchool = 0;
		
		for ( i=1; i LTE rs_student.recordCount; i++ ){
			propertyAdvice.parseProperty(rs_student["student_prop"][i]);
			if ( propertyAdvice.getInSchool() ) inSchool++;
		}
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('teacherByPoint')#</cfoutput>"><i class="mrs img btnList"></i><span class="uiButtonText">学分指导教师</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i>本科生管理 - <cfoutput>#rs_teacher.tch_name#</cfoutput>
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labStudent">class="active"</cfif> id="labStudent" tabTarget="Student">学籍档案</span>
						<span <cfif currentTab eq "labDetail">class="active"</cfif> id="labDetail" tabTarget="Detail">详细信息</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<div id="Student" class="tabContent">

					<div class="noticeBlock">
                         	<div class="operation">
                                   <a class="uiButton" href="<cfoutput>#buildURL('studentSearchOfPoint', passArgs)#</cfoutput>"><i class="mrs img btnAdd"></i></i><span class="uiButtonText"><b>添加本科生</b></span></a>
                              </div>
						<p><span class="img icon16x16 message"></span>在籍学生 <em><cfoutput>#rs_student.recordCount#</cfoutput></em> 名, 目前在校学生 <em><cfoutput>#inSchool#</cfoutput></em> 名. </p>
                              
						<hr/>
					</div>
                         
                         <cfif rs_student.recordCount eq 0>
						<div class="systemNotice">
							<h3><span class="img icon16x16 info"></span>没有数据</h3>
							<p>请先添加指导本科生．</p>
						</div>
					</cfif>
					
					<div class="clearfix">
						
                              <cfloop query="rs_student">
                                        
                                        <cfset structInsert(passArgs, "STU", rs_student.stu_id, true) />
                                        <cfset propertyAdvice.parseProperty(rs_student.student_prop) />
                                        
                                        <div class="UISmallUserCard">
                                             <div class="cardContent <cfif not propertyAdvice.getInSchool()>disabled</cfif>">
                                                  <a href="<cfoutput>#buildURL('studentDetail', passArgs)#</cfoutput>"><img class="img" src="<cfoutput>#getProperty('cdnServer')#</cfoutput><cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/graphic/userSmall.png" style="background-image: url('<cfoutput>#getContextRoot()#</cfoutput>/acadmicRes/assets/student/portrait/<cfoutput>#left(rs_student.stu_id,4)#</cfoutput>/<cfoutput>#rs_student.stu_id#</cfoutput>.jpg');"></a>
                                                  <div class="cardDetail">
                                                       <h3><a href="<cfoutput>#buildURL('studentDetail', passArgs)#</cfoutput>"><cfoutput>#rs_student.stu_name#</cfoutput></a> (<cfoutput>#rs_student.nationality#</cfoutput>)</h3>
                                                       <p><cfoutput>#rs_student.stu_id#</cfoutput></p>
                                                  </div>
                                             </div>
                                        </div>
                                        
						</cfloop>

					</div>
					
				</div>
				
				<div id="Detail" class="tabContent">
				
						<cfset row = 0 />
						<table class="UIEditable">
							<thead>
								<tr>
									<td width="18"></td>
									<td >学号</td>
									<td >姓名</td>
									<td >性别</td>
									<td >出生日期</td>
									<!---<td width="100">护照号</td>--->
                                             <td>护照名</td>
									<td >学生类型</td>
									<td>国籍</td>
									<td >在校</td>
									<td colspan="2" align="center" width="35">操作</td>
								</tr>
							</thead>
							<tbody>
                                <cfloop query="rs_student">
									
									<cfset row++ />
									<cfset structInsert(passArgs, "STU", rs_student.stu_id, true) />
                                             <cfset structInsert(passArgs, "stuName", rs_student.stu_name, true) />
									<cfset propertyAdvice.parseProperty(rs_student.student_prop) />
									
									<tr class="editRows <cfif not propertyAdvice.getInSchool()>alertRow</cfif>">
										<td class="index"><cfoutput>#row#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_student.stu_id#</cfoutput></span></td>
										<td><cfoutput>#rs_student.stu_name#</cfoutput></td>
										<td><cfif rs_student.stu_sex eq "1">男<cfelse>女</cfif></td>
										<td><span class="numeric"><cfoutput>#rs_student.stu_birthday#</cfoutput></span></td>
										<!---<td><span class="numeric"><cfoutput>#rs_student.stu_idcard#</cfoutput></span></td>--->
                                                  <td><cfoutput>#rs_student.stu_name_english#</cfoutput></td>
										<td><cfif rs_student.name eq "" >无<cfelse><cfoutput>#rs_student.name#</cfoutput></cfif></td>
										<td><cfoutput>#rs_student.nationality#</cfoutput></td>
										<td><cfif propertyAdvice.getInSchool()>是<cfelse><span class="alertCell">否</span></cfif></td>
										<td><a href="<cfoutput>#buildURL('studentDetail', passArgs)#</cfoutput>" class="stat details"></a></td>
                                                  <td><a href="<cfoutput>#buildURL('studentRemoveTeacherDo', passArgs)#</cfoutput>" onclick="return checked();" title="删除" class="stat delete"></a></td>
									</tr>
								</cfloop>
							</tbody>
						</table>
					
					
				</div>
                    
                    <script language="javascript" type="text/javascript">
				
                    	function checked(){
						var msg = "您真的确定要删除吗？\n\n请确认！"; 
						if (confirm(msg)==true){ 
							return true; 
						}else{ 
							return false; 
						} 
					}
                    
                    </script>
				
			</div>
		</li>
	</ul>
</div>